采用demo3方式

<script src="https://code.jquery.com/jquery-1.11.3.js"></script>

    <div class="login_frame" style="position:relative";>
        <div class="login_gl" style="margin-top:10px;">
            <div id="msgdiv"></div>
        </div>

        <div class="login_gl" style="margin-top:10px;">
            <span class="login_wz" >登录</span>
        </div>

        <div class="login_gl" style="margin-top:10px;">
            <input id="loginid" name="loginid" type="text" placeholder="请输入您的用户名" value="hello"/>
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <input id="password" name="password" type="password" placeholder="请输入您的密码" value="123456" />
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <button  id="login_btn" style="font-size:16px;">登录</button>
        </div>

        <div class="login_gl" style="margin-top:10px;">
            <button  id="test1" style="font-size:16px;">test1</button>
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <button  id="test2" style="font-size:16px;">test2</button>
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <button  id="nologintips" style="font-size:16px;">nologintips</button>
        </div>
        <div class="login_gl" style="margin-top:20px;">
            <form id="infoLogoForm" enctype='multipart/form-data'>
                <div class="cnt-updateWrapper" >
                    <div>
                        <div id="loadImg" class="cnt-img-content">
                            <img id="logo" class="ctn-uploadImg" src="https://www.baidu.com/img/baidu_jgylogo3.gif" draggable="false">
                            <div id="licenseBox" class="ctn-licence">
                                选择要上传的图片
                                <input type="file" id="selectFile" name="file" accept="image/*" style="height:40px">
                            </div>
                            <div>
                                <button id="doUpload" class="btn btn-default cnt-save" type="button" disabled="false">上传</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>


</div>
<script type="text/javascript">
	var domainUrl="http://localhost:18003";

	$.ajaxSetup({
        global: false,
        // 允许携带证书,添加之后跨域跳转页面失败
        xhrFields: {
            withCredentials: true
        },
        // // 允许跨域
        crossDomain: true,
        complete: function(XMLHttpRequest, textStatus){
            // console.log("XMLHttpRequest=",XMLHttpRequest);
            // console.log("XMLHttpRequest.json=",JSON.stringify(XMLHttpRequest));
            // console.log("textStatus=",textStatus);
        }
    });

    var uploading = false;


    $("#doUpload").click(function () {
        $("#doUpload").attr('disabled',true);

        // $("#logo").attr("src",getObjectURL($('#infoLogoForm')[0]));
        if(uploading){
            alert("文件正在上传中，请稍候");
            return false;
        }
        $.ajax({
            url: domainUrl + "/upload",
            type: 'POST',
            cache: false,
            data: new FormData($('#infoLogoForm')[0]),
            processData: false,
            contentType: false,
            dataType:"json",
            beforeSend: function(){
                uploading = true;
            },
            success : function(msg) {
                uploading = false;
                console.log(msg);
                $("#msgdiv").text(JSON.stringify(msg));
            }
        });
    })

    $("#selectFile").on("change", function(){
        console.log($("#selectFile")[0]);
        var readFile = new FileReader();
        var mfile = $("#selectFile")[0].files[0];
        console.log(mfile);
        if(mfile != undefined){
            readFile.readAsDataURL(mfile);
            readFile.onload = function() {
                var img = $("#logo");
                img.attr("src", this.result);
                $("#doUpload").attr('disabled',false);
            }
        }else {
            //如果点击'选择文件后取消,则不让上传,否则上传的是个空文件'
            $("#doUpload").attr('disabled',true);
        }
    });

    $("#login_btn").click(function(){
        $("#msgdiv").text("登录中...如果一直显示该字符请查看浏览器console");
	   var formdata = new FormData();
       var loginid = $.trim($("#loginid").val());
       var password = $.trim($("#password").val());
        if(loginid == ""){
            alert("请输入用户名");
            return false;
        }else if(password == ""){
            alert("请输入密码");
            return false;
        }
		formdata.append("loginid",loginid);
		formdata.append("password",password);
        //ajax去服务器端校验

        $.ajax({
            type:"POST",
            url:domainUrl+"/login",
            data:formdata,
			processData:false,
            contentType:false,
            dataType:'json',
            // async: false,
            success:function(msg,textStatus, request){
                console.log(request);
                console.log(sessionStorage);
                console.log("cookie",document.cookie)
               // var jsessionid= sessionStorage.getItem("JSESSIONID");
               //  console.log("jsessionid="+jsessionid);
               //   jsessionid= sessionStorage.getItem("access_token");
               //  console.log("jsessionid="+jsessionid);
                $("#msgdiv").text(JSON.stringify(msg));
				console.log(msg);
            }
        });
});

    $("#test1").click(function(){
        //ajax去服务器端校验
        $("#msgdiv").text("处理中...如果一直显示该字符请查看浏览器console");


        $.ajax({
            type:"POST",
            url:domainUrl+"/test1",
            processData:false,
            contentType:false,
            dataType:'json',
            success:function(msg){
                $("#msgdiv").text(JSON.stringify(msg));
            },
            error:function(response, ajaxOptions, thrownError){
                console.log("response=",response);
                console.log("ajaxOptions=",ajaxOptions);
                console.log("thrownError=",thrownError);
                $("#msgdiv").text(JSON.stringify(response));
            }
        });
    });

    $("#test2").click(function(){
        //ajax去服务器端校验
        $("#msgdiv").text("处理中...如果一直显示该字符请查看浏览器console");


        $.ajax({
            type:"POST",
            url:domainUrl+"/test2",
            processData:false,
            contentType:false,
            dataType:'json',
            success:function(msg){
                $("#msgdiv").text(JSON.stringify(msg));
            },
            error:function(response, ajaxOptions, thrownError){
                console.log("response=",response);
                console.log("ajaxOptions=",ajaxOptions);
                console.log("thrownError=",thrownError);
                $("#msgdiv").text(JSON.stringify(response));
            }
        });
    });

    $("#nologintips").click(function(){
        //ajax去服务器端校验
        $("#msgdiv").text("处理中...如果一直显示该字符请查看浏览器console");

        $.ajax({
            type:"POST",
            url:domainUrl+"/nologintips",
            processData:false,
            contentType:false,
            dataType:'json',
            success:function(msg){
                $("#msgdiv").text(JSON.stringify(msg));
            }
        });
    });

</script>